package com.chixing.controller;

import com.chixing.pojo.Customer;
import com.chixing.pojo.Hotel;
import com.chixing.service.HotelService;
import com.chixing.service.MyOrderService;
import com.chixing.util.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpSession;

@Controller
public class MyOrderController {
    @Autowired
    private MyOrderService myOrderService;

    @GetMapping("index/order")
    public ModelAndView getByCusAndHotelId(HttpSession session){
        Customer customer = (Customer) session.getAttribute("loginCustomer");
        ServerResponse orderAndHotelInfo = myOrderService.getByCusAndHotelId(customer.getCusId());
        ModelAndView mav = new ModelAndView();
        mav.addObject("orderAndHotelInfo",orderAndHotelInfo);
        mav.setViewName("order_payment/myorder");
        return mav;
    }

/*    @GetMapping("index/order")
    public ModelAndView getByusId(HttpSession session){
        Customer customer = (Customer) session.getAttribute("loginCustomer");
        ServerResponse serverResponse = myOrderService.getByCusId(customer.getCusId());
        ModelAndView mav = new ModelAndView();
        mav.addObject("serverResponse",serverResponse);
        mav.setViewName("order_payment/myorder");
        return mav;
    }*/

}
